﻿<%@ page title="商品介绍" language="C#" masterpagefile="baseMasterPage.master" autoeventwireup="true" inherits="cardshow, App_Web_cphtqxoh" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        #buyCount{font-size:14px;border:1px #C0C0C0 solid;width:60px;margin:0px 5px 0px 5px}
        #address{width:460px}
        .uipaystate{display:none}

    </style>
    <script type="text/javascript">
        window.onload = function() {
            __reanderlinkproduct();
            if(gE("buyCount"))
            {
                __InputMask("buyCount","number");
            }
        }
        //挂接商品
        function __reanderlinkproduct() {
            var v = $card.queryCardTypeByCardTypeId("<%=Request.QueryString["cardtypeid"]%>");
            if (v[0].productids) {
                $ajax.load({ url: "admin/xmlproduct.aspx", data: "json=json&productid=" + unescape(v[0].productids), type: "json", method: "GET" });

                var i, _html = "<ol>";
                for (i = 0; i < $ajax.responseJson.length; i++) {

                    _html += "<li id=\"p" + $ajax.responseJson[i].productid + "\"><div class=\"pic1\"><a href=\"" + $ajax.responseJson[i].showpageurl + "?productid=" + $ajax.responseJson[i].productid + "\" target=\"_blank\"><img src=\"" + unescape($ajax.responseJson[i].picpath1) + "\"/></a></div><a class=\"productname\" href=\"" + $ajax.responseJson[i].showpageurl + "?productid=" + $ajax.responseJson[i].productid + "\" target=\"_blank\">" + unescape($ajax.responseJson[i].productname) + "</a></li>"
                }
                _html += "</ol>";
                $("#linktoproduct").html(_html);

            }
        }
    
    //购买激活卡
    function __buycard()
    {
    
        //return;
        //var v=$card.createNewCard("<%=Request.QueryString["cardtypeid"]%>");
        
        //$("#cardnumtext").text(v.cardnum);
        //$("#cardpasswordtext").text(v.cardpassword);
        
        $("#Txtbuycount").val($("#buyCount").val());
        $("#TxtSubject").val("购买“"+$("#ctl00_ContentPlaceHolder1_cardtypename").text()+"”"+$("#buyCount").val()+"张卡");
        $("#TxtBody").val($("#TxtSubject").val());
        $("#TxtTotal_fee").val(parseInt($("#buyCount").val())*$("#ctl00_ContentPlaceHolder1_thiscardprice").text());
        
        $("#buytext").text($("#TxtSubject").val()+",共需支付"+$("#TxtTotal_fee").val()+"元。");
        $('#dialogactivecard').dialog({
            autoOpen: true,
            width: 600,
            resizable: false,
            modal:true,
            title: "在线购买"
        });
    }
    
    function __pay() {
        if(jsformcheck(event,"formsubmitalipay"))
        {
            $(".uipaystep1").hide();
            $(".uipaystate").show();
            document.getElementById("formsubmitalipay").submit();
        }
    }

    function __payok() {
        $('#dialogactivecard').dialog("close");
        $('#dialogpayok').dialog({
            autoOpen: true,
            width: 600,
            resizable: false,
            modal:true,
            title: "温馨提示"
        });
    }
    
    function __payerror()
    {
        $(".uipaystep1").show();
        $(".uipaystate").hide();
    }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <br/>
    <h1 runat="server" id="cardtypename" class="cardtypename"></h1>
    <div class="center"><img src=""  runat="server" id="cardimage"/></div><br/><br/>
    
    <div class="cardshow center"><span class="cardprice">市场价:<span runat="server" id="thiscardprice"></span>元</span></div>
    <br />
    <div class="center" id="Divguest" runat="server">
        购买数量<input name="buyCount" type="text" id="buyCount" value="1"/>张<br/>
        <a href="javascript:__buycard()" class="btn2">立刻购买</a>
    </div>


    <br />
    <div class="fieldset"><span class="legend">此卡的礼品包含有以下商品</span></div>
    <br />
    <div id="linktoproduct" class="goodslist"></div>
    
    <div id="dialogactivecard" class="X-dialog">
        <div class="uipaystep1">
            <form action="/alipay/default.aspx" method="post" id="formsubmitalipay" target="_blank">
                <div id="buytext"></div>
                <div id="alerttext" runat="server"></div>
                <table>
                    <tr>
                        <td>姓名：</td>
                        <td><input type="text" name="Txttruename" datatype="string" maxlength="50" alerttext="姓名" nullabled="false" /></td>
                    </tr>
                    <tr>
                        <td>寄送地址：</td>
                        <td><input type="text" name="Txtaddress" id="address" datatype="string" maxlength="255" alerttext="寄送地址" nullabled="false" /></td>
                    </tr>
                    <tr>
                        <td>联系电话：</td>
                        <td><input type="text" name="Txtphone" datatype="string" maxlength="50" alerttext="联系电话" nullabled="false" /></td>
                    </tr>
                </table>
                <input type="hidden" name="TxtTotal_fee" id="TxtTotal_fee" readonly="readonly" />
                <input type="hidden" name="TxtSubject" id="TxtSubject"/>
                <input type="hidden" name="TxtBody" id="TxtBody"/>
                <input type="hidden" name="Txtbuycount" id="Txtbuycount"/>
                
                <input type="hidden" name="TxtCardTypeid" id="TxtCardTypeid" value="<%=Request.QueryString["cardtypeid"] %>"/>
            </form>
            <div class="center"><a href="javascript:__pay();" class="btn2">在线支付</a></div>
        </div>
        <div class="uipaystate center">
            <a href="javascript:__payok()" class="btn">已经支付成功</a>
            <a href="javascript:__payerror()" class="btn">支付失败，重试支付。</a>
        </div>
        
    </div>
    
    <div id="dialogpayok" class="X-dialog">
        <div id="alerttext2" runat="server"></div>
    </div>
</asp:Content>

